package domain
import (
	"../db"
)
type Market struct {
	Id string  `json:id`
	Name string `json:name`

}

func GetMarket(id string) (m Market,ok bool) {
	//db, _ := sql.Open("mysql", "root:root@tcp(localhost:3306)/Market")

	stmt, _ := db.MysqlDb.Prepare("SELECT  id,name FROM market WHERE id = ?")
	rs, err := stmt.Query(id)

	if err == nil && rs.Next() {
		err = rs.Scan(&m.Id, &m.Name)
		rs.Close()
		ok  =  true
	}else{
		ok = false
	}
	return
}